package cn.js.sangu.unitStore.entity;

import cn.hutool.core.annotation.Alias;
import cn.js.sangu.unitStore.dto.FileListDTO;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.JsonNode;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
import java.util.List;

/**
 * 说明：工单分发表
 * 作者：linshuo
 * 日期：2024/10/29 9:10
 */

@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
@TableName("bom")
public class BomEntity {
    @TableId(type = IdType.AUTO)
    private Integer id;

    @Alias("清单名称")
    private String workName;

    @Alias("清单描述")
    private String workDescription;

    @Alias("附件名称")
    private String attachName;

    @Alias("附件id(多个以,分开)")
    private String attachIds;

    @Alias("附件类型(加工后的位置)")
    private String attachType;

    @Alias("附件大小")
    private Integer attachCount;

    @Alias("创建人id")
    private Integer creator;

    @Alias("创建人名称")
    @TableField(exist = false)
    private String creatorName;

    @Alias("创建时间")
    @TableField(fill = FieldFill.INSERT)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
    private Date creatTime;

    @Alias("更新人id")
    private Integer modifier;

    @Alias("更新人名称")
    @TableField(exist = false)
    private String modifierName;

    @Alias("更新时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
    private Date updateTime;

    @Alias("接收人id")
    private Integer recipient;

    @Alias("接收人名称")
    @TableField(exist = false)
    private String recipientName;

    @Alias("接收时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
    private Date receiptTime;

    @Alias("加工状态") // 加工状态：0正在加工，1加工成功，2加工失败
    private Integer state;

    @Alias("上次接收状态")
    @TableField(exist = false)
    private Integer receiptStateLast;

    @Alias("下载次数")
    private Integer downCount;

    @Alias("备注")
    private String remark;

    @Alias("文件列表")
    @TableField(exist = false)
    private List<FileListDTO> fileList;

    @Alias("文件列表JSON")
    @TableField("file_list_json")
    private JsonNode fileListJson;

    @Alias("用时")
    private String takeTime;

    @Alias("自动编码")
    @TableField(exist = false)
    private Boolean autoCode;

    @Alias("去重类型")
    @TableField(exist = false)
    private String deWeightType;

}
